package lelouet.datacenter.simulation.eventhandlers;

import java.util.Collections;
import java.util.List;

import lelouet.datacenter.simulation.Event;
import lelouet.datacenter.simulation.EventHandler;
import lelouet.datacenter.simulation.events.VMMove;
import lelouet.datacenter.simulation.events.VMSLAViolation;
import lelouet.datacenter.simulation.events.VMSpecChange;
import lelouet.datacenter.simulation.events.VMStateChanged;

/**
 * an {@link EventHandler} that do one thing when any event happens : delegate
 * to handleEvent(), that does nothing<br />
 * One can override this function to get a special behavior such as printing the
 * event, and/or override specific handlers
 */
public class DiscardEventHandler implements EventHandler {

	/**
	 * do nothing
	 * 
	 * @return an empty unmodifiable list.
	 */
	public List<Event> handleEvent(Event event) {
		return Collections.emptyList();
	}

	/** delegates the event to {@link #handleEvent(Event)} */
	@Override
	public List<Event> handleRequestUnhandled(VMSLAViolation event) {
		return handleEvent(event);
	}

	/** delegates the event to {@link #handleEvent(Event)} */
	@Override
	public List<Event> handleSpecChange(VMSpecChange event) {
		return handleEvent(event);
	}

	/** delegates the event to {@link #handleEvent(Event)} */
	@Override
	public List<Event> handleStateChanged(VMStateChanged event) {
		return handleEvent(event);
	}

	/** delegates the event to {@link #handleEvent(Event)} */
	@Override
	public List<Event> handleMove(VMMove event) {
		return handleEvent(event);
	}

}
